<?php

class step1Action extends sfAction
{
    public function execute($request)
    {
        $this->getUser()->setAttribute('install_wall_post_enabled', 1);

        // We have is a special case here: url_params are used to be appended
        // to urls links inside a page so they are tracked by analytics correctly
        // on next page.
        //
        // On this page, we're using the parameter to track the current page,
        // hence the need to remove the &ref=parameter.
        //$this->access_token = $request->getParameter('access_token');
        $signed_request = App::getFacebookClient()->getSignedRequest();
        $this->access_token = $signed_request['oauth_token'];
        $url_params = LogInstall::log($request, 'step1');
        $params = array();
        parse_str($url_params, $params);
        unset($params['ref']);
        $this->tracking_params = urlencode(http_build_query($params, '', '&'));
        return sfView::SUCCESS;
    }
}